import logging

teststr = '<strong id="hgzp3"><span id="hgzp4" style="font-size: 15px;"></span></strong><strong id="hgzp0"><span id="hgzp1" style="font-size: 15px;">Test title<br>Step by Step guide to create and launch a Web Application with Google App Engine, Python and Django</span>'


def strip_tags(str):
	in_tag = False
	res = ""
	for c in str:
		if in_tag:
			if c == '>':
				in_tag = False
				res = res + ' '
		else:
			if c == '<':
				in_tag = True
			elif c == '\n':
				res = res + ' '
			else:
				res = res + c
	return res.strip()	
	
def title_from_content(content):
	title = strip_tags(content[0:100])[0:50].strip()
	logging.debug('title:'+title)
	return title